package cn.edu.imnu.common.util;

import java.util.ResourceBundle;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

/**
 * 常量类
 * @author MCR
 *
 */
public class ConstatFinalUtil
{
	/**
	 * 日志对象
	 */
	public static Logger LOGGER = LogManager.getLogger(ConstatFinalUtil.class);
	
	/*json配置文件*/
	public static JSONObject RESOURCE_JSON = new JSONObject();
	/*json配置文件，info信息*/
	public static JSONObject INFO_JSON = new JSONObject();
	/*存储随机数的字母表*/
	public static String ALLSTR = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz";
	/*静态代码块*/
	static
	{
		/*读取json配置文件*/
		FileUtil fileUtil = new FileUtil();
		try
		{
			String resourceStr = fileUtil.readFile(ConstatFinalUtil.class.getClassLoader().getResourceAsStream("resourceInfo.json"));
			RESOURCE_JSON = (JSONObject) JSON.parse(resourceStr);
			/*获取json配置文件中info信息*/
			INFO_JSON = RESOURCE_JSON.getJSONObject("info");
			ConstatFinalUtil.LOGGER.info("json配置文件");
		} catch (Exception e)
		{
			ConstatFinalUtil.LOGGER.error("json配置文件转换出错了",e);
		}
		
	}
}
